<template>
  <div>
   
    <!-- 底部部分 -->
    <footer class="footer">
      <span class="todo-count"
        ><strong>{{ sum }}</strong
        >剩余</span
      >
      <ul class="filters">
        <li>
          <a
            class="selected"
            href="#/"
            :class="{ selected: type === 'all' }"
            @click="changeType('all')"
            >全部</a
          >
        </li>
        <li>
          <a
            href="#/active"
            :class="{ selected: type === 'active' }"
            @click="changeType('active')"
            >进行中</a
          >
        </li>
        <li>
          <a
            href="#/completed"
            :class="{ selected: type === 'completed' }"
            @click="changeType('completed')"
            >已完成</a
          >
        </li>
      </ul>
      <button v-if="isShowClear" @click="clear" class="clear-completed">
        清除已完成
      </button>
    </footer>
  </div>
</template>

<script>
export default {
  components: {},
  props: {
    sum: Number,
    isShowClear: {
      type: Boolean,
      default: true,
    },
    type: String,
  },
  data() {
    return {}
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    //清除已完成
    clear() {
      this.$emit('clear')
    },
    //切换
    changeType(type) {
      this.$emit('changeType', type)
    },
  },
}
</script>

<style scoped></style>
